#include "hintmanager.h"
#include "widgets/mainwindow.h"
#include "ui_mainwindow.h"

HintState::HintState( const QString& hintText, QObject* parent )
	: QObject(parent)
	, m_hintText(hintText)
{
	
}

void HintState::appendHighlightedObject( QPointer<QObject> object )
{
	m_highlightedObjects << object;
}

void HintState::paint( QPainter& painter )
{

}

HintManager& HintState::hintManager()
{
	return *qobject_cast<HintManager*>(parent());
}

void HintState::update()
{

}

HintManager::HintManager(QObject *parent)
	: QObject(parent)
{
	connect(&m_timer, &QTimer::timeout, this, &HintManager::onTimer);
	m_timer.start(30);
	m_stateCreateNewProject = new HintState("Click on New to create new project", this);
	m_stateCreateNewProject->appendHighlightedObject(mainWindow().ui->actionFileNew);
}

MainWindow& HintManager::mainWindow()
{
	return *qobject_cast<MainWindow*>(parent());
}

void HintManager::onTimer()
{
	mainWindow().update();
}

void HintManager::paint( QPainter& painter )
{
	m_stateCreateNewProject->update();
	m_stateCreateNewProject->paint(painter);
}
